import { Emit } from 'vue-property-decorator';
<template>
  <el-col :span="span || 6">
    <el-form-item
      :label="label"
      :label-width="labelwidth || '120px'"
      :prop="prop"
      :class="searchFrom ? 'searchFrom2' : ''"
    >
      <el-input
        size="small"
        :type="type"
        :value="value"
        :rows="rows"
        :disabled="disabled"
        :placeholder="phTxt"
        @input="onInput"
        resize="none"
      />
    </el-form-item>
  </el-col>
</template>

<script>
// other

export default {
  name: "BaseFormInput",
  props: {
    rows: {
      type: Number,
      default: 3,// 输入框行数，只对 type="textarea" 有效
    },
    prop: {
      type: String, //表单，在使用 validate、resetFields 方法的情况下，该属性是必填的
    },
    label: {
      type: String, //标签文本
    },
    span: {
      type: Number, //col
    },
    type: {
      type: String, // input 类型
    },
    phTxt: {
      type: String, // 输入框占位文本
    },
    disabled: {
      type: Number, // 禁用
    },
    searchFrom: {
      type: Boolean, // 是否是搜索类型
    },
    labelwidth: {
      type: String,
      default: "120px", // 标签文本宽度
    },
  },
  data() {
    return {
      value: "",
    };
  },
  methods: {
    onInput(val){
      this.value=val
      this.$emit("input",val)
    }
  },
};
</script>

<style lang="scss" scope>
.searchFrom2 {
  display: flex !important;
  .el-form-item__label-wrap {
    flex: 0 0 4.3em;
  }
  .el-input--medium {
    width: 100%;
    padding-right: 15px;
  }
}
</style>
